import request from '@/utils/request'
// import { List } from '@element-plus/icons-vue/dist/types'

//登录接口
export const userLoginService = ({ UserPassword, UserName }) => {
  return request.post('/UserLogin', { UserPassword, UserName })
}
//注册账号
export const userRegisterAPI = ({
  UserPassword,
  UserName,
  UserAccount,
  UserPhoneNumber,
  UserSex,
  Status
}) => {
  return request.post('/ZhuCe', {
    UserPassword,
    UserName,
    UserAccount,
    UserPhoneNumber,
    UserSex,
    Status
  })
}
//修改个人资料
export const userUpdateAPI = ({
  UserPassword,
  UserName,
  UserAccount,
  UserPhoneNumber,
  UserSex,
  Status
}) => {
  return request.post('/Gai', {
    UserPassword,
    UserName,
    UserAccount,
    UserPhoneNumber,
    UserSex,
    Status
  })
}
//AI
//export const AiAPI = (data) => {
//  return request.post(
//    'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro?access_token=24.49329fb4d977ad0291c29de2d3e15a81.2592000.1729674069.282335-115665672',
//   data
// 24.99e5b24f972f0ef52e19aeeff06e8966.2592000.1734966829.282335-115819848)
//}
export const AiAPI = (data) => {
  const url = `https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/yi_34b_chat?access_token=[24.58c7debded59c1257c78d173c8d23e2e.2592000.1734967389.282335-115819848]`
  return request.post(url, data)
}
//问题搜索
export const searchQuestionAPI = ({ ProblemName }) => {
  return request.post(`/User/Problem/${ProblemName}`)
}
//举报问题
export const reportQuestionAPI = ({ JuBaoUserName, FaBuUserName, ProblemId, Reason }) => {
  return request.post('/User/JuBaoProblem', {
    JuBaoUserName,
    FaBuUserName,
    ProblemId,
    Reason
  })
}
//获取问题详细信息(回答)
export const getProblemDetailAPI = ({ ProblemId }) => {
  return request.post(`/User/Answer/${ProblemId}`)
}
//举报回答
export const reportAnswerAPI = ({ JuBaoUserName, FaBuUserName, AnswerId, Reason }) => {
  return request.post('/User/JuBaoHuiDa', {
    JuBaoUserName,
    FaBuUserName,
    AnswerId,
    Reason
  })
}
//查看我举报的回答
export const getMyReportAnswerAPI = ({ UserName }) => {
  return request.post(`/JuBaoHuiDaDto/${UserName}`)
}
//查看我举报的问题
export const getMyReportQuestionAPI = ({ UserName }) => {
  return request.post(`/JuBaoProblemDto/${UserName}`)
}
//发布回答
export const sendAnswerAPI = ({ UserName, ProblemId, Status, AnswerName }) => {
  return request.post('/User/AddAnswer', {
    UserName,
    ProblemId,
    Status,
    AnswerName
  })
}
//个人详细信息
export const getUserDetailAPI = ({ UserName }) => {
  return request.post(`/ZZxx/${UserName}`)
}
// 查看自己发布的问题
export const getUserProblemAPI = ({ UserName }) => {
  return request.post(`/User/UserProblem/${UserName}`)
}
//删除问题
export const deleteProblemAPI = ({ ProblemId }) => {
  return request.post(`/User/DeleteProblem/${ProblemId}`)
}
//查看自己发布的回答
export const getUserAnswerAPI = ({ UserName }) => {
  return request.post(`/User/UserAnswer/${UserName}`)
}
//删除回答
export const deleteAnswerAPI = ({ AnswerId }) => {
  return request.post(`/User/DeleteAnswer/${AnswerId}`)
}
//查看自己发布的问题的回答
export const getUserProblemAnswerAPI = ({ ProblemId }) => {
  return request.post(`/User/ProblemAnswer/${ProblemId}`)
}
//给回答评分
export const sendGradeAPI = ({ UserName, Id, Gradle, ProblemId }) => {
  return request.post('/EditGrade', {
    UserName,
    Id,
    Gradle,
    ProblemId
  })
}
//结算问题
export const settleProblemAPI = ({ Id }) => {
  return request.post(`/user/SettleMoney/${Id}`)
}

//发布问题
export const addProblemAPI = ({ ProblemName, Tag, Money, UserName, Status }) => {
  return request.post('/AddProplem', {
    ProblemName,
    Tag,
    Money,
    UserName,
    Status
  })
}
//获取个人资金
export const getUserMoneyAPI = ({ UserName }) => {
  return request.post(`/ZhanShi/${UserName}`)
}
//修改个人资金
export const updateUserMoneyAPI = ({ UserName, Money }) => {
  return request.post('/TiXian', {
    UserName,
    Money
  })
}
//获得所有标签
export const getTagAPI = () => {
  return request.post('/User/Tag')
}
//根据标签搜索问题
export const searchQuestionByTagAPI = ({ Tag }) => {
  return request.post(`/User/STag/${Tag}`)
}
//随机展示问题
export const randomQuestionAPI = () => {
  return request.post('/RandomUser')
}
//获取账户交易明细
export const getUserTransactionAPI = ({ UserName }) => {
  return request.post(`/User/MoneyMingXi/${UserName}`)
}

//收藏问题
export const collectProblemAPI = ({ UserName, ProblemId }) => {
  return request.post(`/User/AddProblem/${ProblemId}/${UserName}`)
}

//查看我收藏的问题
export const getMyCollectProblemAPI = ({ UserName }) => {
  return request.post(`/User/SelectProblem/${UserName}`)
}

//取消收藏
export const cancelCollectProblemAPI = ({ UserName, ProblemId }) => {
  return request.post(`/User/DeletLikeProblem/${ProblemId}/${UserName}`)
}

//获取平台总问题数
export const getTotalProblemAPI = () => {
  return request.post('/TotalProblem')
}
//获取平台总用户数
export const getTotalUserAPI = () => {
  return request.post('/TotalUser')
}
//获取平台总用户数
export const getTotalMoneyAPI = () => {
  return request.post('/NewLogin')
}
//获取平台总回答数
export const getTotalAnswerAPI = () => {
  return request.post('/TotalAnswer')
}
//获取今日新发布问题数
export const getNewProblemAPI = () => {
  return request.post('/NewProblem')
}
//获取今日新发布回答数
export const getNewAnswerAPI = () => {
  return request.post('/NewAnswer')
}
//获取今日平台登录人数
export const getTodayInfoAPI = () => {
  return request.post('/TodayLogin')
}
//问题回答数量
export const getAnswerCountAPI = ({ ProblemId }) => {
  return request.post(`/User/CountAnswer/${ProblemId}`)
}
//回复回答
export const replyAnswerAPI = ({ AnswerId, UserName, ProblemId, AnswerName }) => {
  return request.post(`/UserAAnswer/${AnswerId}`, {
    UserName,
    ProblemId,
    AnswerName
  })
}
//获取子回答
export const getSubAnswerAPI = ({ FatherAnswerId }) => {
  return request.post(`/ChildrenAnswer/${FatherAnswerId}`)
}
